import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 实例化驱动
driver = webdriver.Chrome()
# 打开网页
driver.get("https://www.baidu.com/")
# 全屏
driver.maximize_window()
# 定位输入框
# driver.find_element(By.XPATH,"//*[@name='wd']").send_keys("selenium")
"""
//*[@name='wd']：
//*找所有
@name找到这个元素名字 = wd

"""
# 通过xpath手写  id=kw的
# driver.find_element(By.XPATH,"//*[@id='kw']").send_keys("张鑫暗号")

# 通过xpath手写  id包含kw的
# driver.find_element(By.XPATH,"//*[contains(@id,'kw')]").send_keys("张鑫暗号2号")

#通过xpath手写   联合两个元素值定位
# driver.find_element(By.XPATH,"//*[@id='kw' and @name='wd']").send_keys("张鑫暗号3号")

# 通过xpath手写  定位超链接的文本内容
driver.find_element(By.XPATH,"//*[text()='更多']").click()
"""
text()：文本内容等于更多的，点击
"""

time.sleep(5)
